﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StudentManagement.Interfaces;

namespace StudentManagement.SearchTypes
{
    public class NameSearch : ISearchType
    {
        #region ISearchType Members
        public List<Student> Search(string filter)
        {
            List<Student> listStudent = new List<Student>();
            ListStudent interior = StudentManage.GetInstance().ListStudent;
            while (interior != null)
            {
                if (interior.Student != null && interior.Student.FullName.Contains(filter))
                {
                    listStudent.Add(interior.Student);
                }
                interior = interior.NextStudent;
            }
            return listStudent;
        }
        #endregion
    }
}
